/**
 * Copyright (c) 2012 Fujian FUNO Mobile Communication Technology Co., Ltd.
 * All rights reserved by FUNO.
 */
package org.quartz.examples.mytest;

import java.util.Date;
import org.quartz.DateBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

/** 
 * TODO
 * 
 * @version V1.1
 * @author zhangguangying
 * @date 2013-1-21
 */
public class MyTrigger {
	
	public void run() throws SchedulerException {
		SchedulerFactory factory = new StdSchedulerFactory();
		Scheduler scheduler = factory.getScheduler();
		
		java.util.Date triggerStartTime = DateBuilder.todayAt(17, 9, 00);
		
		JobDetail jobDetail = JobBuilder.newJob(MyJob.class).withIdentity("myjob", "mygroup").build();
		Trigger trigger = TriggerBuilder.newTrigger().withIdentity("mytrigger", "mygroup").startAt(triggerStartTime).build();
		scheduler.scheduleJob(jobDetail, trigger);
		scheduler.start();
	}
	
	public static void main(String[] args) throws SchedulerException {
		MyTrigger myTrigger = new MyTrigger();
		myTrigger.run();
	}

}
